package com.wmm.renwu1;

public class SendFactory {

    //自定义成员方法实现对象的创建
    public Sender produce(String type){
        if (type.equals("mail")){
            return new MaliSender();
        }
        if (type.equals("sms")){
            return new SmsSender();
        }
        return null;
    }

    //加入静态修饰
    public static Sender produceMail(){
        return new MaliSender();
    }

    public Sender produceSms(){
        return new SmsSender();
    }
}
